package com.dianxin.smartpark.web.attendance;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.attendance.SmartParkHolidayDetailQO;
import com.dianxin.smartpark.dao.qo.attendance.SmartParkShiftQO;
import com.dianxin.smartpark.service.attendance.SmartParkShiftService;
import com.dianxin.smartpark.service.vo.attendance.SmartParkShiftVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 班次管理
 * @program: smart-park
 * @description: 班次管理
 * @author: chenyong
 * @create: 2021-07-26 16:11
 */
@RestController
@RequestMapping("/smartpark/attendance/Shift")
public class SmartParkShiftController {

    @Resource
    private SmartParkShiftService smartParkShiftService;

    /**
     * 班次信息分页查询
     * @Description:  分页查询
     * @Author: ChenYong
     * @Date: 2021/7/26 0026
     * @param smartParkShiftQO:
     * @Return: CommonResponseBody<List<SmartParkShiftVO>>
     */
    @PostMapping("/getShifts")
    @RecordLog(name = "班次管理查询")
    @SaCheckPermission("/attendance/Shift/getShifts")
    public CommonResponseBody<List<SmartParkShiftVO>> getShifts(@RequestBody SmartParkShiftQO smartParkShiftQO) {
        return smartParkShiftService.getShifts(smartParkShiftQO);
    }

    /**
     * 保存班次信息
     * @Description:  保存班次信息
     * @Author: ChenYong
     * @Date: 2021/7/26 0026
     * @param smartParkShiftQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/saveShift")
    @RecordLog(name = "班次管理新增")
    @SaCheckPermission("/attendance/Shift/saveShift")
    public CommonResponseBody saveShift(@RequestBody SmartParkShiftQO smartParkShiftQO){
        return smartParkShiftService.saveShift(smartParkShiftQO);
    }

    /**
     * 修改班次信息
     * @Description:  修改班次信息
     * @Author: ChenYong
     * @Date: 2021/7/26 0026
     * @param smartParkShiftQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/updateShift")
    @RecordLog(name = "班次管理修改")
    @SaCheckPermission("/attendance/Shift/updateShift")
    public CommonResponseBody updateShift(@RequestBody SmartParkShiftQO smartParkShiftQO){
        return smartParkShiftService.updateShift(smartParkShiftQO);
    }

    /**
     * 根据ID删除班次信息
     * @Description:  根据ID删除班次信息
     * @Author: ChenYong
     * @Date: 2021/7/26 0026
     * @param smartParkShiftQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/deleteShift")
    @RecordLog(name = "班次管理删除")
    @SaCheckPermission("/attendance/Shift/deleteShift")
    public CommonResponseBody deleteShift(@RequestBody SmartParkShiftQO smartParkShiftQO) {
        return smartParkShiftService.deleteShift(smartParkShiftQO.getIds());
    }

    /**
     * 根据ID获取班次详情信息
     * @Description:  根据ID获取班次详情信息
     * @Author: ChenYong
     * @Date: 2021/7/30 0030
     * @param smartParkShiftQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/shiftDetails")
    @RecordLog(name = "班次管理详情")
    @SaCheckPermission("/attendance/Shift/shiftDetails")
    public CommonResponseBody shiftDetails(@RequestBody SmartParkShiftQO smartParkShiftQO) {
        return smartParkShiftService.shiftDetails(smartParkShiftQO);
    }
}
